import "bootstrap";
import "bootstrap/scss/bootstrap.scss";
import "../style/products.scss";
import "normalize.css";
import "@fortawesome/fontawesome-free/js/all";

// import displayState from './demoPage/display';

// console.warn(`mode is: ${process.env.NODE_ENV}`);
// console.warn(displayState); //引入并打印是为了测试共同引用模块的打包

// $(function () {
//     $(".manufacturing").on('mouseenter',function () {
//         $(this).addClass("interr").siblings().removeClass("interr")
//         $(this).addClass('intelligentss')
//     })
// })
// $(function () {
//     $(".manufacturing").on('mouseleave',function () {
//         $(this).addClass('interr')
//   $(this).removeClass('interr')
//
//     })
//
// })
$(function () {
  const $manufacturing = $(".manufacturing");
  const $detailsMt = $(".details-mt");
  $manufacturing.each(function (index, item) {
    if (item.className.indexOf("interr") !== -1) {
      $(item).children(".manufacturing-as").css({
        display: "none",
      });
      $(item).children(".manufacturing-hides").css({
        display: "flex",
      });
    }
  });
  $detailsMt.hide().first().show();

  $manufacturing.on("mouseenter", function () {
    const $this = $(this);
    const $siblings = $this.siblings();
    const $index = $this.index();
    $this.addClass("interr").children(".manufacturing-as").css({
      display: "none",
    });
    $this.children(".manufacturing-hides").css({
      display: "flex",
    });

    $siblings.removeClass("interr").children(".manufacturing-as").css({
      display: "flex",
    });
    $siblings.children(".manufacturing-hides").css({
      display: "none",
    });
    $detailsMt.hide().eq($index).show();
  });
});

$(document).scroll(function () {
  const $scrollTop = $(document).scrollTop();
  console.log($scrollTop);
  if ($scrollTop > 150) {
    $("#header").addClass("scrollStyle");
  } else {
    $("#header").removeClass("scrollStyle");
  }
});
